home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1997 / HAM Radio 1997.iso / vcls / date / examples / exthan0.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-04-08  |  1.1 KB  |  56 lines

  1. unit Exthan0;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, AdTerm, AdPort;
  8.  
  9. type
  10.   TMyListBox = class(TListBox)
  11.     procedure TriggerAvail(var Message : TMessage); message APW_TRIGGERAVAIL;
  12.   end;
  13.  
  14.   TForm1 = class(TForm)
  15.     ApdComPort1: TApdComPort;
  16.     ApdTerminal1: TApdTerminal;
  17.     Register: TButton;
  18.     procedure RegisterClick(Sender: TObject);
  19.   private
  20.     ListBox1 : TMyListBox;
  21.     { Private declarations }
  22.   public
  23.     { Public declarations }
  24.   end;
  25.  
  26. var
  27.   Form1: TForm1;
  28.   GlobalPort : TApdComPort;
  29.  
  30. implementation
  31.  
  32. {$R *.DFM}
  33.  
  34. procedure TMyListBox.TriggerAvail(var Message : TMessage);
  35. var
  36.   I : Word;
  37.   S : String;
  38. begin
  39.   S := '';
  40.   for I := 1 to Message.wParam do
  41.     S := S + GlobalPort.GetChar;
  42.   Items.Add(S);
  43. end;
  44.  
  45. procedure TForm1.RegisterClick(Sender: TObject);
  46. begin
  47.   GlobalPort := ApdComPort1;
  48.   ListBox1 := TMyListBox.Create(Self);
  49.   ListBox1.Name := 'ListBox1';
  50.   ListBox1.Parent := Self;
  51.   ListBox1.Show;
  52.   ApdComPort1.RegisterTriggerHandler(ListBox1.Handle, nil);
  53. end;
  54.  
  55. end.
  56.